import request from '@/utils/request'
import { exportFileByUrl, GetParams } from "@/utils/common.js";

// 包销业务
// 当日持仓分析
export function GetUnderWritePositionData(params) {
  return request({
    url: 'budms/distrib/position',
    method: 'get',
    params
  })
}
export function GetUnderWritePositionDataDownloadUrl( params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distrib/position${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
// 当日持仓分析-交易维度明细数据
export function  GetUnderWritePositionTradeListData(params) {
  return request({
    url: 'budms/distrib/position/trade/list',
    method: 'get',
    params
  }) 
}
export function GetUnderWritePositionTradeListDataDownloadUrl( params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distrib/position/trade/list${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
// 当日持仓分析-债券维度明细数据
export function  GetUnderWritePositionBondListData(params) {
  return request({
    url: 'budms/distrib/position/bond/list',
    method: 'get',
    params
  })
}
export function GetUnderWritePositionBondListDataDownloadUrl( params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distrib/position/bond/list${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
// 专户处置及利润分析
export function  GetUnderWritePositionprofitData(params) {
  return request({
    url: 'budms/distrib/positionprofit',
    method: 'get',
    params
  })
}
export function GetUnderWritePositionprofitDataDownloadUrl( params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distrib/positionprofit${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
// 专户处置及利润分析-交易维度明细数据
export function  GetUnderWritePositionprofitTradeListData(params) {
  return request({
    url: 'budms/distrib/positionprofit/trade/list',
    method: 'get',
    params
  })
}
export function GetUnderWritePositionprofitTradeListDataDownloadUrl( params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distrib/positionprofit/trade/list${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}
// 专户处置及利润分析-债券维度明细数据
export function  GetUnderWritePositionprofitBondListData(params) {
  return request({
    url: 'budms/distrib/positionprofit/bond/list',
    method: 'get',
    params
  }) 
}
export function GetUnderWritePositionprofitBondListDataDownloadUrl( params) {
  const url = `${
    process.env.VUE_APP_API_URL
  }/budms/distrib/positionprofit/bond/list${GetParams(params)}`;
  exportFileByUrl(url, params.name + ".xls");
}